var c = Object.defineProperty;
var o = (s, e, t) => e in s ? c(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
var n = (s, e, t) => (o(s, typeof e != "symbol" ? e + "" : e, t), t);
import { inject as l } from "vue";
class m {
  constructor() {
    //
    n(this, "api");
    this.api = l("API");
  }
  //
  apiGet(e) {
    var t;
    if ((t = this.api) != null && t.query)
      return this.api.query(e);
  }
  async getKafkaList() {
    const e = "v1/services/messagingServices?fields=owner&limit=9999";
    try {
      return await this.apiGet(e);
    } catch {
      return;
    }
  }
  async getTopicList(e) {
    const t = `v1/topics?service=${e}&fields=owner%2Ctags&include=non-deleted`;
    try {
      return await this.apiGet(t);
    } catch {
      return;
    }
  }
  async getDataLinkList() {
    const e = "v1/services/databaseServices?fields=owner&limit=9999";
    try {
      return await this.apiGet(e);
    } catch {
      return;
    }
  }
  async getNextDataLinkList(e) {
    let t = "services/databaseServices?fields=owner&limit=999", i = "server";
    if (e) {
      const r = encodeURI(e.fullyQualifiedName);
      e.columns ? (i = "field", t = `tables/name/${r}?fields=columns,followers,joins,tags,owner,dataModel,tableConstraints,viewDefinition,domain,dataProducts,votes,usageSummary&include=all&limit=9999`) : e.database ? (i = "table", t = `tables?databaseSchema=${r}&include=non-deleted&limit=9999`) : e.service ? (i = "schema", t = `databaseSchemas?fields=owner,usageSummary&database=${r}&include=non-deleted&limit=9999`) : e.connection && (i = "database", t = `databases?service=${r}&fields=owner%2Ctags%2CusageSummary&include=non-deleted&limit=9999`);
    }
    const a = await this.apiGet("v1/" + t);
    return a.type = i, a;
  }
  async getDataLinkListByType(e) {
    const t = `v1/search/query?q=** AND (serviceType:${e})`;
    try {
      return await this.apiGet(t);
    } catch {
      return;
    }
  }
}
export {
  m as U
};
